<?

$mediaid=$this->input->post('mediaid');
$media=ORM::factory('media', $this->input->post('mediaid'));
echo '<p>mediatitle: '.$media->title.'</p>';
echo '<p>mediatype: '.$media->type.'</p>';
echo '<p>url: '.$media->url.'</p>';
echo '<p>original filename: '.$media->origfilename.'</p>';
echo '<hr />';
switch ($media->type){
	
	case "image":
		$url=$media->get_resized_url(500,500);
		echo html::image($url);
		break;
	
	case "pdf":
		echo '<embed  src="'.url::base().$media->url.'" width="100%" height="500"></embed>';
		break;
	
	case "movie":
		echo '
		<object id="player" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" name="player" width="100%" height="400">
			<param name="movie" value="'.url::base().'mediaadmin/flash/jwmediaplayer/player.swf" />
			<param name="allowfullscreen" value="true" />
			<param name="allowscriptaccess" value="always" />
			<param name="flashvars" value="file='.url::base().$media->url.'&autostart=true" />			
		</object>
		';
		break;
	case "zip":
		echo html::file_anchor($media->url);
		break;
	
		
}

?>